<?php
class Sedes_Form_Sede extends Form_Base {
	
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		//Crea el formulario para el registro de roles del sistema
		$this->setName ( 'sedes' );
		$this->setMethod("POST");
		
		$domConfig = Zend_Registry::get('domConfig'); //esto se crea en el bootstrap
		
		$array_elements[] = new Zend_Form_Element_Hidden("codsede");
		       
		$element = new Zend_Form_Element_Select('tiposede');
		$element->setLabel ( 'Tipo : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->TIPOSEDE->toArray());
        $element->setRequired(true);
        $array_elements[]=$element;
		
		$element = new Zend_Form_Element_Text ( 'nombresede' );
		$element->setLabel ( 'Nombre: ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
        $array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'direccion' );
		$element->setLabel ( 'Dirección : ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'telefono' );
		$element->setLabel ( 'Teléfono : ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
		
		$element = new Zend_Form_Element_Text ( 'correo' );
		$element->setLabel ( 'Correo : ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$element->addValidator ( 'EmailAddress');
		$array_elements[]=$element;
		
		$element = new App_Form_Element_Autocompletar("ubicacion", "codubicacion", "/generales/ubicacion/autolista");
		
//		$element = new Zend_Form_Element_Text ( 'ubicacion' );
		$element->setLabel ( 'Ubicación : ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Hidden("codubicacion");
		$array_elements[]=$element;
		
		$element = new Zend_Form_Element_Text('estudiantes');
		$element->setLabel ( 'Estudiantes : ' );
		$element->addValidator('digits');
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
        $array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'nombredirector' );
		$element->setLabel ( 'Nombre director: ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'correodirector' );
		$element->setLabel ( 'Correo director: ' );
		$element->setAttribs(array('size'=>50));
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$element->addValidator ( 'EmailAddress');
		$array_elements[]=$element;
		
		$element = new Zend_Form_Element_Text ( 'telefonodirector' );
		$element->setLabel ( 'Teléfono director: ' );
		$element->setAttribs(array('size'=>50));
//		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'nombreresponsable' );
		$element->setLabel ( 'Nombre responsable: ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
				
        $element = new Zend_Form_Element_Select('estado');
		$element->setLabel ( 'Estado : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->DOM_ESTADO->toArray());
        $element->setRequired(true);
        $array_elements[]=$element;
		     
       $submit = new Zend_Form_Element_Submit('btnSubmit');
       $submit->setValue('Guardar');
       $submit->setLabel("Guardar");
       $submit->setAttrib("class", "iceCmdBtn");
       $array_elements[] = $submit;
       
       $this->addElements($array_elements);
	   $this->loadTableDecorators();
	}

}